/*
 * @lc app=leetcode.cn id=1436 lang=typescript
 *
 * [1436] 旅行终点站
 */

// @lc code=start
function destCity(paths: string[][]): string {
    return paths.find((i) => {
        const [start, end] = i;
        return paths.every((ii) => {
            if (ii === i) return true;
            return end !== ii[0];
        });
    })![1];
}
// @lc code=end
